/**
 * 
 */
package org.iridium.allcomments.util;

import org.iridium.allcomments.exception.AllCommentsException;

/**
 * @author caoyi
 * TODO 此方法没有地方在用，应该可以删除。
 */
public class StringTools {
	/**
	 * to lengthen a string a defined length with blanks at it's right side.
	 * @param src
	 * @param length
	 * @return
	 * @throws AllCommentsException 
	 */
	public static String lengthenWithBlanks(String src, int length)
			throws AllCommentsException {
		if (src.length() > length) {
			throw new AllCommentsException("\"" + src + "\" is longer than "
					+ length + ". Length() operation not needed.");
		}
		StringBuffer sb = new StringBuffer(src);
		for (int i = src.length(); i < length; i++) {
			sb.append(" ");
		}
		return sb.toString();
	}
}
